<template>
  <div class="one">
    <div class="item" @click="shareGoodsInfo(item)" v-for="item in GoodsList" :key="item.id">
      <img :src="item.src" v-lazy="item.src" />
      <div class="itemMsg">
        <div class="Item-title">{{item.title}}</div>
        <div class="Item-msg">已售{{item.count}}</div>
        <div class="Item-price">
          <span>{{item.price}}</span>
          <van-icon name="cart" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'YscShopOne',
  props: ['GoodsList'],
  data () {
    return {

    };
  },

  created () {

  },

  methods: {
    // 商品详情
    shareGoodsInfo (item) {
      console.log(item);
      // 存储当前点击数据
      window.sessionStorage.setItem('goodsInfo', JSON.stringify(item))
      // 
      this.$bus.$emit('goodsInfoBack', true)
    }
  },
};
</script>

<style lang="less" scoped>
.one {
  padding: 10px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  .item {
    width: 49%;
    height: 240px;
    background-color: #fff;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
    img {
      width: 100%;
      height: 130px;
    }
    .itemMsg {
      font-size: 14px;
      padding: 0px 10px 0px;
      box-sizing: border-box;
      .Item-title {
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
      }
      .Item-msg {
        font-size: 10px;
        color: #a6a5a5;
        margin: 3px 0px;
      }
      .Item-price {
        font-size: 16px;
        font-weight: 400;
        width: 100%;
        display: flex;
        color: #f96c2f;

        span {
          flex: 1;
        }
        .van-icon {
          flex: 1;
          text-align: right;
          font-size: 18px;
        }
      }
      .Item-price span::before {
        content: "¥";
        font-size: 12px;
      }
    }
  }
}
</style>